﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace JeanFish.Blog.Storage.Providers.EF
{
    public static class PostLabelHelper
    {
        public static IQueryable<EF.Post> HasPostLabel(this IQueryable<EF.Post> posts, PostLabel label)
        {
            long postDeletedStatus = (long)PostLabel.Deleted;
            return posts.Where(t => (t.label & postDeletedStatus) == postDeletedStatus);
        }
        public static IQueryable<EF.Post> HasNoPostLabel(this IQueryable<EF.Post> posts, PostLabel label)
        {
            long postDeletedStatus = (long)PostLabel.Deleted;
            return posts.Where(t => (t.label & postDeletedStatus) != postDeletedStatus);
        }
    }
}
